package com.artisan.o2o.enums;

public enum ProductCategoryStateEnum {

    SUCCESS(1, "操作成功"), INNER_ERROR(-1001, "操作失败"), NULL_SHOP(-1002, "Shop信息为空"), EMPETY_LIST(-1003, "请输入商品目录信息");

    private int state;
    private String stateInfo;

    /**
     * @param state
     * @param stateInfo
     * @Title:ProductCategoryStateEnum
     * @Description:构造函数
     */
    private ProductCategoryStateEnum(int state, String stateInfo) {
        this.state = state;
        this.stateInfo = stateInfo;
    }

    public int getState() {
        return state;
    }

    public String getStateInfo() {
        return stateInfo;
    }

    /**
     * @param index
     * @return
     * @Title: stateOf
     * @Description: 通过state获取productCategoryStateEnum, 从而可以调用ProductCategoryStateEnum
     * #getStateInfo()获取stateInfo
     * @return: ProductCategoryStateEnum
     */
    public static ProductCategoryStateEnum stateOf(int index) {
        for (ProductCategoryStateEnum productCategoryStateEnum : values()) {
            if (productCategoryStateEnum.getState() == index) {
                return productCategoryStateEnum;
            }
        }
        return null;
    }

}
